package com.zzx.tree;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.parent();
    }
    /**
     * 树的父节点表示方法
     */
    private void parent() {
        Tree tree = new Tree();
        TreeNode a = new TreeNode(0,"A", -1);
        TreeNode b = new TreeNode(1,"B", 0);
        TreeNode c = new TreeNode(2,"C", 0);
        TreeNode d = new TreeNode(3,"D", 1);
        TreeNode e = new TreeNode(4,"E", 2);
        TreeNode f = new TreeNode(5,"F", 2);
        TreeNode g = new TreeNode(6,"G", 3);
        TreeNode h = new TreeNode(7,"H", 3);
        TreeNode i = new TreeNode(8,"I", 3);
        TreeNode j = new TreeNode(9,"J", 4);

        List<TreeNode> nodes = new ArrayList<TreeNode>();
        nodes.add(a);
        nodes.add(b);
        nodes.add(c);
        nodes.add(d);
        nodes.add(e);
        nodes.add(f);
        nodes.add(g);
        nodes.add(h);
        nodes.add(i);
        nodes.add(j);
        tree.setNodes(nodes);
    }
}
